<template>
    <div>
        <table>
            <tr>
                <td>登录名</td>
                <td><input type="text" v-model="data.name"></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" v-model="data.pwd"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="button" value="登录" @click="login()"></td>
            </tr>
        </table>

    </div>
</template>

<script setup lang="ts">

import {ref} from 'vue'

const data=ref({
    name:'',
    pwd:''
})

const login=()=>{
    if(data.value.name=="admin"&&data.value.pwd=="123"){
        localStorage.setItem("islogin","true");//当登陆成功进保存登录状态true
        alert('登陆成功');
    }

}


</script>
